package com.neotiq.smartdevice.model;

import android.app.Activity;
import android.os.Bundle;

import java.util.ArrayList;

public class DeviceManager {
    private static ArrayList<Device> list;
    private static Activity delegate;
    
    public static ArrayList<Device> getDevicesList() {
        return DeviceManager.getDevicesList(false);
    }
    
    public static ArrayList<Device> getDevicesList(boolean update) {
        if (update || list==null) {
            list = new ArrayList<Device>();
//            list.add(new Device(DeviceType.TGL_BTN, delegate));
        }
        return list;
    }

    public static void setDelegate(Activity del) {
        delegate = del;
    }
    
    public static void setDevicesList(Bundle savedInstanceState, Activity delegate) {
        list = new ArrayList<Device>();
    }

    public static void addDevice(DeviceType dt) {
        if (list == null) {
            list = new ArrayList<Device>();
        }
        list.add(new Device(dt, delegate));
    }

    public static void removeDevice(Device device) {
        list.remove(device);
    }
}
